package com.lzw.d25bingso.task;

import android.os.AsyncTask;

import com.lzw.d25bingso.bean.Viewpagers;
import com.lzw.d25bingso.callback.DataCallBack;
import com.lzw.d25bingso.tools.HttpUtils;
import com.lzw.d25bingso.tools.PaseJson;

import java.util.List;

/**
 * Created by lzw on 2017/5/17.
 */

public class DataLoadTask extends AsyncTask<String,Void,List<Viewpagers>>{

    private DataCallBack dataCallBack;

    public DataLoadTask(DataCallBack dataCallBack) {
        this.dataCallBack = dataCallBack;
    }

    @Override
    protected List<Viewpagers> doInBackground(String... params) {
        String jsonStr = HttpUtils.getStringResult(params[0]);
        return PaseJson.pase(jsonStr);
    }

    @Override
    protected void onPostExecute(List<Viewpagers> viewpagerses) {
        super.onPostExecute(viewpagerses);
        dataCallBack.sendData(viewpagerses);
    }
}
